<template>
    <div class="content">
        <div id="app">
            <div class="sidebar">
                <Card></Card>
                <List></List>
            </div>
            <div class="main">
                <div v-if="rightPage==1||rightPage==3">
                    <Header></Header>
                    <Message></Message>
                    <Text :websocket=ws></Text>
                </div>
                <div v-else-if="rightPage==2">
                    <Detail></Detail>
                </div>
                <div v-else>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import Card from "../components/Card.vue";
import List from "../components/List.vue";
import Text from "../components/Text.vue";
import Message from '../components/Message.vue';
import Header from '../components/Header.vue';
import Detail from '../components/Detail.vue';
import {useStore} from 'vuex';
import {computed} from "vue";
// import {initSocket} from "../utils/websocket";

export default {
    components: {Card, List, Message, Text, Header, Detail},
    setup() {
        const ws = null;
        let store = useStore();
        //初始化信息
        //从store获取数据
        store.commit('INIT_DATA');
        store.commit('ADD_CONTACTS');
        store.commit('UPDATE_HOSPITAL');

        console.log('id--', sessionStorage.getItem('ms_psd'))

        return {
            ws,
            collapse:computed(() => store.state.collapse),
            showDetail:computed(() => store.state.showDetail),
            showChat:computed(() => store.state.showChat),
            rightPage:computed(() => store.state.rightPage),
        };
    },
}
</script>

<style scoped>
.content {
    background-image: url(../assets/img/background.jpg);
}

#app {
    margin: 20px auto;
    width: 900px;
    height: 700px;
    overflow: hidden;
    border-radius: 3px;
    background-color: #20a0ff;
}

.sidebar {
    position: relative;
    height: 100%;
    float: left;
    width: 250px;
    color: #f4f4f4;
    background-color: #242425;

}

.main {
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #eee;
}

/*加行注释更新代码*/

</style>